package com.yourenbang.transaction.api.service.pay.transaction;

import com.yourenbang.lingyun.constants.enums.ServiceNameConstants;
import com.yourenbang.lingyun.core.message.Result;
import com.yourenbang.transaction.api.model.dto.fund.*;
import com.yourenbang.transaction.api.model.dto.pay.*;
import com.yourenbang.transaction.api.model.vo.pay.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.validation.Valid;
import java.math.BigDecimal;
import java.util.List;

/**
 * 交易
 */
@FeignClient(value = ServiceNameConstants.SERVICE_TRANSACTION)
@RequestMapping("/service/transaction")
public interface TransactionApiService {

    /**
     * 实时达标金额
     */
    @RequestMapping(value = "/reachamt")
    Result<ReachAmtVO> reachAmt(@RequestBody ReachAmtDTO dto);

    /**
     * 获取交易额（主要用于统计优惠费率10万是否达到）
     * 除借记卡之外其他都算
     */
    @RequestMapping(value = "/discount/trade/count")
    Result<ReachAmtVO> discountTradeAmt(@RequestBody ReachAmtDTO dto);

    /**
     * 实时交易笔数-M40
     * @description 查询归属于该盟友的机具中交易笔数最高的
     * @return 机具号和交易笔数
     */
    @RequestMapping(value = "/trade/count")
    Result<TradeCountVO> tradeCount(@RequestBody TradeCountDTO dto);

    /**
     * 违激活金额
     */
    @RequestMapping(value = "/activate/amount")
    Result<ActivateAmtVO> activateAmount(@RequestBody ActivateAmtDTO dto);

    /**
     * 单个用户多个月交易额 - 通讯录点进商户详情
     */
    @RequestMapping(value = "/months/amount")
    Result<List<MonthAmountVO>> monthsAmount(@Valid @RequestBody QueryMonthListAmountDTO dto);

    /**
     * 单个用户总交易额 - 通讯录点进商户详情
     */
    @RequestMapping(value = "/user/total/amount")
    Result<AmountVO> userTotalAmount(@Valid @RequestBody QueryUserTotalAmountDTO dto);

    /**
     * 多个用户总交易额 -通讯录商户列表
     */
    @RequestMapping(value = "/users/total/amount")
    Result<List<UsersAmountVO>> usersTotalAmount(@Valid @RequestBody QueryUsersTotalAmountDTO dto);

    /**
     * 多个用户当月总交易额 -通讯录商户列表
     */
    @RequestMapping(value = "/users/current/month/total/amount")
    Result<List<UsersAmountVO>> usersCurrentMonthTotalAmount(@Valid @RequestBody QueryUsersCurrentMonthTotalAmountDTO dto);/**

    /*
     * 单个用户多个月交易额 - 通讯录点进商户详情 -按机具归属盟友查询
     */
    @RequestMapping(value = "/months/amount/by/ally")
    Result<List<MonthAmountVO>> monthsAmountByAlly(@Valid @RequestBody QueryMonthListAmountByAllyDTO dto);

    /**
     * 单个用户总交易额 - 通讯录点进商户详情 -按机具归属盟友查询
     */
    @RequestMapping(value = "/user/total/amount/by/ally")
    Result<AmountVO> userTotalAmountByAlly(@Valid @RequestBody QueryUserTotalAmountByAllyDTO dto);

    /**
     * 多个用户总交易额 -通讯录商户列表 -按机具归属盟友查询
     */
    @RequestMapping(value = "/users/total/amount/by/ally")
    Result<List<UsersAmountVO>> usersTotalAmountByAlly(@Valid @RequestBody QueryUsersTotalAmountByAllyDTO dto);

    /**
     * 多个用户当月总交易额 -通讯录商户列表 -按机具归属盟友查询
     */
    @RequestMapping(value = "/users/current/month/total/amount/by/ally")
    Result<List<UsersAmountVO>> usersCurrentMonthTotalAmountByAlly(@Valid @RequestBody QueryUsersCurrentMonthTotalAmountByAllyDTO dto);

    /**
     * M40优惠消费金额
     */
    @RequestMapping(value = "/yxy/amt/m40")
    Result<BigDecimal> yxyAmtM40(@Valid @RequestBody TradeCountDTO dto);

    /**
     * M40消费金额
     */
    @RequestMapping(value = "/yxy/amt/m40/all")
    Result<BigDecimal> yxyAmtM40All(@Valid @RequestBody TradeCountDTO dto);

    /**
     * 所有卡类型的交易额 (目前m40使用)
     */
    @RequestMapping(value = "/yxy/amt/all/card")
    Result<BigDecimal> yxyAmtAllCard(@Valid @RequestBody TradeCountDTO dto);

    /**
     * 查询交易笔数
     */
    @RequestMapping(value = "/transaction/count")
    Result<Integer> transactionCount(@Valid @RequestBody QueryTradeCountDTO dto);

    /**
     * 查询交易笔数-M40
     */
    @RequestMapping(value = "/transaction/count/m40")
    Result<Integer> transactionCountM40(@Valid @RequestBody QueryTradeCountDTO dto);

    /**
     * 查询押金交易
     */
    @RequestMapping(value = "/query/pledge")
    Result<PayTransaction> queryPledge(@Valid @RequestBody QueryPledgeDTO dto);

    /**
     * 根据订单号查询交易
     */
    @RequestMapping(value = "/query/transaction/by/order/no")
    Result<PayTransaction> queryTransactionByOrderNo(@Valid @RequestBody QueryTransactionDTO dto);

}
